package com.mcx.modules.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author mcx
* @date 2022-04-30
**/
@Entity
@Data
@Table(name="player_equip")
public class PlayerEquip implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "编号")
    private Integer id;

    @Column(name = "status",nullable = false)
    @NotNull
    @ApiModelProperty(value = "状态")
    private Integer status;

    @Column(name = "player_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "玩家Id")
    private Integer playerId;

    @Column(name = "equip_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "基础装备编号")
    private Integer equipId;

    @Column(name = "type")
    @ApiModelProperty(value = "type")
    private Integer type;

    @Column(name = "quality")
    @ApiModelProperty(value = "品质")
    private Integer quality;

    @Column(name = "star")
    @ApiModelProperty(value = "星级")
    private Integer star;

    @Column(name = "enchant_level")
    @ApiModelProperty(value = "强化等级")
    private Integer enchantLevel;

    @Column(name = "enchant_count")
    @ApiModelProperty(value = "强化次数")
    private Integer enchantCount;

    @Column(name = "base_attr1_type")
    @ApiModelProperty(value = "基础属性1类型")
    private Integer baseAttr1Type;

    @Column(name = "base_attr1_value")
    @ApiModelProperty(value = "基础属性1值")
    private Integer baseAttr1Value;

    @Column(name = "base_attr2_type")
    @ApiModelProperty(value = "基础属性2类型")
    private Integer baseAttr2Type;

    @Column(name = "base_attr2_value")
    @ApiModelProperty(value = "基础属性2值")
    private Integer baseAttr2Value;

    @Column(name = "hp")
    @ApiModelProperty(value = "HP")
    private Integer hp;

    @Column(name = "mp")
    @ApiModelProperty(value = "MP")
    private Integer mp;

    @Column(name = "attack")
    @ApiModelProperty(value = "攻击")
    private Integer attack;

    @Column(name = "defense")
    @ApiModelProperty(value = "防御")
    private Integer defense;

    @Column(name = "hit")
    @ApiModelProperty(value = "命中")
    private Integer hit;

    @Column(name = "dodge")
    @ApiModelProperty(value = "闪避")
    private Integer dodge;

    @Column(name = "cri")
    @ApiModelProperty(value = "暴击")
    private Integer cri;

    @Column(name = "res")
    @ApiModelProperty(value = "抗性")
    private Integer res;

    @Column(name = "createtime",nullable = false)
    @NotNull
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createtime;

    @Column(name = "updatetime")
    @UpdateTimestamp
    @ApiModelProperty(value = "更新时间")
    private Timestamp updatetime;

    @Column(name = "is_put_on",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否已经穿戴")
    private Integer isPutOn;

    public void copy(PlayerEquip source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}